@extends('layouts.admin.application')

@section('css')
    <link rel="stylesheet" href="/vendor/daterangepicker/daterangepicker.css">
@endsection

@section('content')

    <div class="admin-content">

        <div class="am-cf am-padding">
            <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">新增企业充值方案</strong> /
                <small>Create</small>
            </div>
        </div>
        <hr>
        @include('admin._flash')

        <div class="am-g">
            <div class="am-u-sm-12 am-u-md-12">

                <form class="am-form" action="/admin/rechargeway" method="post">
                    {{ csrf_field() }}


                    <div class="am-g am-margin-top">
                        <div class="am-u-sm-4 am-u-md-2 am-text-right">
                            所属门店
                        </div>
                        <div class="am-u-sm-8 am-u-md-4 am-u-end col-end">
                            <select  data-am-selected="{btnWidth: '100%',  btnStyle: 'secondary', btnSize: 'sm', maxHeight: 360, searchBox: 1}"
                                     name="store_id">
                                <option value="">请选择</option>
                                @foreach($cates as $c)
                                    <option value="{{$c->id}}"@if($c->id==old('store_id')) selected @endif >{{$c->name}}</option>
                                @endforeach
                            </select>
                        </div>
                    </div>
                    <div class="am-g am-margin-top">
                        <div class="am-u-sm-4 am-u-md-2 am-text-right">
                            方案简述
                        </div>
                        <div class="am-u-sm-8 am-u-md-4">
                            <input type="text" class="am-input-sm" name="plan_name" value="{{old('plan_name')}}" >
                        </div>
                        <div class="am-hide-sm-only am-u-md-6">如：充值10000元一年内可同时在店5人</div>
                    </div>

                    <div class="am-g am-margin-top sort">
                        <div class="am-u-sm-4 am-u-md-2 am-text-right">
                            排序
                        </div>
                        <div class="am-u-sm-8 am-u-md-4 am-u-end col-end">
                            <input type="text" name="sort" class="am-input-sm" value="{{old('sort')}}">
                        </div>
                    </div>

                    <div class="am-g am-margin-top sort">
                        <div class="am-u-sm-4 am-u-md-2 am-text-right">
                            需充值金额
                        </div>
                        <div class="am-u-sm-8 am-u-md-4 am-u-end col-end">
                            <input type="text" name="plan_price" class="am-input-sm" value="{{old('plan_price')}}">
                        </div>
                        <div class="am-hide-sm-only am-u-md-6">如：10000元则填写10000</div>
                    </div>

                    <div class="am-g am-margin-top sort">
                        <div class="am-u-sm-4 am-u-md-2 am-text-right">
                            赠送金额
                        </div>
                        <div class="am-u-sm-8 am-u-md-4 am-u-end col-end">
                            <input type="text" name="add_price" class="am-input-sm" value="{{old('add_price')}}">
                        </div>
                        <div class="am-hide-sm-only am-u-md-6">如：100元则填写100</div>
                    </div>

                    <div class="am-g am-margin-top sort">
                        <div class="am-u-sm-4 am-u-md-2 am-text-right">
                            可同时在店人数
                        </div>
                        <div class="am-u-sm-8 am-u-md-4 am-u-end col-end">
                            <input type="text" name="go_number" class="am-input-sm" value="{{old('go_number')}}">
                        </div>
                        <div class="am-hide-sm-only am-u-md-6">如：5人则填写5</div>
                    </div>

                    <div class="am-g am-margin-top sort">
                        <div class="am-u-sm-4 am-u-md-2 am-text-right">
                            套餐有效期
                        </div>
                        <div class="am-u-sm-8 am-u-md-4 am-u-end col-end">
                            <input type="text" name="valid" class="am-input-sm" value="{{old('valid')}}">
                        </div>
                        <div class="am-hide-sm-only am-u-md-6">如：1年则填写1</div>
                    </div>


                    <div class="am-margin">
                        <button type="submit" class="am-btn am-btn-primary am-radius">提交保存</button>
                    </div>
                </form>
            </div>
        </div>
    </div>


@endsection
@section('js')
    <script src="/vendor/daterangepicker/moment.js"></script>
    <script src="/vendor/moment/locale/zh-cn.js"></script>
    <script src="/vendor/daterangepicker/daterangepicker.js"></script>

  <script>
      $(function () {
          //时间插件
          $('#date_start').daterangepicker({

              "autoUpdateInput": false,
              "autoApply": true,
              "locale": {
                  "format": "YYYY-MM-DD",
                  "applyLabel": "确定",
                  "cancelLabel": "取消"
              }
          }, function (start, end, label) {
              this.element[0].value = start.format('YYYY-MM-DD') + ' ~ ' + end.format('YYYY-MM-DD');
          });
      });

  </script>
@endsection